clear
capture cd "N:\General\8070_BD_Litigation\Leary\PR_Estate_Taxes_and_Incentives\Journal_Submissions\National_Tax_Journal\RR_materials\Estate_tax_return_data\STATA\input"

import excel table3_2012.xls, firstrow case(lower) clear
rename a state
gen year=2012

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2013.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2013

append using mergedirs
sort state

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2014.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2014

append using mergedirs
sort state

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2015.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2015

append using mergedirs
sort state year

save "mergedirs.dta", replace


///////////////////////////////////////////////////////////////////
clear

import excel table3_2016.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2016

append using mergedirs
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2017.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2017

append using mergedirs
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2018.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2018

append using mergedirs
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2019.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2019

append using mergedirs
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2020.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2020

append using mergedirs
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table3_2021.xls, firstrow case(lower) clear
drop c
rename a state
gen year=2021

append using mergedirs
sort state year

save "mergedirs.dta", replace


///////////////////////////////////////////////////////////////////
clear

import excel table5_2012.xls, firstrow case(lower) clear
rename a state
gen year=2012

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2013.xls, firstrow case(lower) clear
rename a state
gen year=2013
drop c d e f g

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace


///////////////////////////////////////////////////////////////////
clear

import excel table5_2014.xls, firstrow case(lower) clear
rename a state
gen year=2014
drop c d e f g

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2015.xls, firstrow case(lower) clear
rename a state
gen year=2015
drop c d e f g h i j k l

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2016.xls, firstrow case(lower) clear
rename a state
gen year=2016
drop c 

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2017.xls, firstrow case(lower) clear
rename a state
gen year=2017
drop c d e f g h i j k l m n o p q

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2018.xls, firstrow case(lower) clear
rename a state
gen year=2018
drop c d e f g h i j k l m n o p

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2019.xls, firstrow case(lower) clear
rename a state
gen year=2019

drop c

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2020.xls, firstrow case(lower) clear
rename a state
gen year=2020

merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace

///////////////////////////////////////////////////////////////////
clear

import excel table5_2021.xls, firstrow case(lower) clear
rename a state
gen year=2021

drop c d e f g h i j k l m n o p q r s t u


merge m:1 state year using mergedirs
drop if _merge==1
drop _merge
sort state year

save "mergedirs.dta", replace
